<?php
namespace app\admin\model;
use app\common\model\BaseModel;
class Collection extends BaseModel
{
	protected $autoWriteTimestamp = true;
	protected $status_conf=[
			'0'=>'未扣',
			'1'=>'已扣',
			'2'=>'关闭'
		];
	public function getAmountAttr($val){
		return floatval($val);
	}
	public function getNameAttr($val,$data){
		return model('User')->where(['id'=>$data['uid']])->value('name');
	}
	public function getStatusStrAttr($val,$data){
		$status=$data['status'];
    	return $this->status_conf[$status];
	}
	public function getDeadlineAttr($val){
		return date("Y/m/d",$val);
	}
	public function getCollectTimeAttr($val){
		return $val?date("Y/m/d",$val):"/";
	}
}